#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>


int main()
{
  //char * const env[] = { (char*)"haha = heheaaaaaaa",(char*)"PATH=/",NULL };


  printf("I am a process,pid:%d\n",getpid());
  putenv("MYVAL=bbbbbbbbbbbbbbbbbbbbbbbb");

  pid_t id = fork();
  if(id == 0)
  {
      sleep(1);
      //execle("./mytest","mytest",NULL,environ);
      //execle("./mytest","mytest",NULL,env);
      //execle("usr/bin/python3","python3","test.py",NULL);
      //execle("/usr/bin/bash","bash","test.sh",NULL);
      execl("./mytest","mytest",NULL);
      //char* const argv[] = { (char*)"ls",(char*)"-a",(char*)"-l" };
      //execv("/usr/bin/ls",argv);

   // sleep(3);
   // printf("exec begin...\n");
   // //execl("/usr/bin/ls","ls","-a","-l",NULL);
   // //execl("/usr/bin/top","top",NULL);
    printf("exec end ...\n");
  }

  pid_t rid = waitpid(id,NULL,0);
  if(rid > 0)
  {
    printf("wait success\n");
  }

  exit(1);
}
